<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFactoryStatisticalsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('factory_statisticals', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID!')->index('user');
            $table->integer('today_handle_order_count')->default(0)->comment('今日订单处理数');
            $table->integer('total_amount_order')->default(0)->comment('订单总金额-单位分');
            $table->integer('total_order')->default(0)->comment('订单总数');
            $table->integer('total_device')->default(0)->comment('入库总量-生产设备总数');
            $table->integer('total_ship_device')->default(0)->comment('发货设备总数');
            $table->integer('total_device_processed_today')->default(0)->comment('今日处理设备总数-根据最后更新时间决定是否置零');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('factory_statisticals');
    }
}
